<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    <script>
     /*内置对象*/
     var paramstr='name=tom&age=18&address=长沙';
     var params=paramstr.split('&');
     for(let i=0;i<params.length;i++){
         //先取出当前元素等号左边的字符串
         //如果相等，则取出当前元素等号右边的字符串
         let index=params[i].indexOf('=');
         var name=params[i].substring(0,index);
         if(name=='age'){
             let value=params[i].substr(index+1);
             console.log(value);
             }else{

             }
     }

     </script>
</body>
    
   
</html>